<template>
	<view class="settle-container">
      <!-- 全选 -->
		  <label class="radio" @click="changeAllState">
		    <radio color="#C00000" :checked="isFullCheck" /><text>全选</text>
		  </label>
      <!-- 合计 -->
      <view class="amount-box">
        合计:<text class="amount">￥{{checkGoodsAmount}}</text>
      </view>
      <!-- 结算按钮 -->
      <view class="settle">结算({{checkedCount}})</view>
	</view>
</template>

<script>
  import {mapGetters, mapMutations} from 'vuex'
	export default {
		data() {
			return {
				
			};
		},
    computed: {
      ...mapGetters('m_cart', ['checkedCount', 'total', 'checkGoodsAmount']),
      // 判断是否全选
      isFullCheck () {
        return this.total === this.checkedCount 
        }
      },
      methods: {
        // 在m_cart模块中把updateAllGoodsState方法映射到当前页面中
        ...mapMutations('m_cart', ['updateAllGoodsState']),
        // 点击取反状态
        changeAllState () {
          this.updateAllGoodsState(!this.isFullCheck)
        }
      }
    }
</script>

<style lang="scss">
.settle-container{
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background-color: white;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 5px;
  .radio {
    display: flex;
    align-items: center;
  }
  .amount-box {
    .amount {
      color: #C00000;
      font-weight: bold;
    }
  }
  .settle{
    background-color: #C00000;
    height: 50px;
    color: white;
    padding: 0 10px;
    line-height: 50px;
    min-width: 100px;
    text-align: center;
  }
}
</style>
